package com.itheima.demo04.Calendar;

import java.util.Calendar;
import java.util.Date;

public class Demo02Calendar {
    public static void main(String[] args) {
        demo04();
    }

    public static void demo01() {
        Calendar c = Calendar.getInstance();
        int year = c.get(Calendar.YEAR);
        System.out.println(year);
        int month = c.get(Calendar.MONTH) + 1;
        System.out.println(month);
        int date = c.get(Calendar.DATE);
        System.out.println(date);
    }

    public static void demo02() {
        Calendar c = Calendar.getInstance();
        c.set(Calendar.YEAR, 1999);
        int year = c.get(Calendar.YEAR);
        System.out.println(year);
        c.set(Calendar.MONTH, 11);
        int month = c.get(Calendar.MONTH);
        System.out.println(month);
        c.set(Calendar.DATE, 7);
        int date = c.get(Calendar.DATE);
        System.out.println(date);
    }

    public static void demo03() {
        Calendar c = Calendar.getInstance();
        c.add(Calendar.YEAR, 2);
        c.add(Calendar.MONTH, -3);
        int year = c.get(Calendar.YEAR);
        System.out.println(year);
        int month = c.get(Calendar.MONTH);
        System.out.println(month);
        int date = c.get(Calendar.DATE);
        System.out.println(date);
    }
    public static void demo04(){
        Calendar c=Calendar.getInstance();
        Date time = c.getTime();
        System.out.println(time);
    }
}
